package com.roc.web.action.windcontroll;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class JumpMchtSearchCondition extends BaseSearchCondition{
	
	private static final long serialVersionUID = 1L;
	
	private String mchtCd;//商户号
	private String nameBusi;
	private String agentId;//代理商id
	private String certifNo;//法人身份证号码
	private String account;//结算卡账号

	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		
		/*if(Constance.isNotEmpty(nameBusi)){ //商户名称 （模糊）
			filedBeanList.add(new WhereHQLFieldBean("t.mername", nameBusi.trim(), "like", false,"ALL"));
		}*/
		
		if(Constance.isNotEmpty(certifNo)){
			filedBeanList.add(new WhereHQLFieldBean("a.certif_no", certifNo.trim(),"=", false));
		}
		
		if(Constance.isNotEmpty(account)){
			filedBeanList.add(new WhereHQLFieldBean("b.account", account.trim(),"=", false));
		}
		
		if(Constance.isNotEmpty(mchtCd)){
			filedBeanList.add(new WhereHQLFieldBean("a.mcht_cd", mchtCd.trim(),"=", false));
		}
		
		filedBeanList.add(new WhereHQLFieldBean("a.ext1", agentId.trim(),"=", false));
		
		/*filedBeanList.add(new WhereHQLFieldBean("t.agentid", agentId.trim(),"=", false));*/
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		String countSql = "select count(1) " 
				+"from tbl_mcht_inf a left join tbl_mcht_bankaccount b on a.mcht_cd=b.owner_cd left join apstfr.tbl_jump_mcht_inf c on  b.owner_cd=c.mcht_cd " 
				+"where a.status='01' and b.accounttype='01' ";
		return countSql;
	}

	@Override
	protected String getSearchHQL() {
		String sql = "select a.mcht_cd,a.name_busi,a.contact_name,a.contact_phoneno,a.certif,a.certif_no,b.account,c.status,to_char(c.REC_TM,'yyyyMMdd HH24miss'),c.mcc_group " 
				+"from tbl_mcht_inf a left join tbl_mcht_bankaccount b on a.mcht_cd=b.owner_cd left join apstfr.tbl_jump_mcht_inf c on  b.owner_cd=c.mcht_cd " 
				+"where a.status='01' and b.accounttype='01' ";
		return sql;
	}

	@Override
	protected String getOrderPartOfHQL() {
		return "order by a.mcht_cd";
	}

	public String getMchtCd() {
		return mchtCd;
	}

	public void setMchtCd(String mchtCd) {
		this.mchtCd = mchtCd;
	}

	public String getAgentId() {
		return agentId;
	}

	public void setAgentId(String agentId) {
		this.agentId = agentId;
	}

	public String getNameBusi() {
		return nameBusi;
	}

	public void setNameBusi(String nameBusi) {
		this.nameBusi = nameBusi;
	}

	public String getCertifNo() {
		return certifNo;
	}

	public void setCertifNo(String certifNo) {
		this.certifNo = certifNo;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}
	
}
